<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 

<h:head><title>TravelDream</title>
	<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
</h:head> 
<body>

<h:outputStylesheet library="css" name="primefaces-style.css"/>

<p:panel header="Admin Console">
		<h:panelGrid columns="10" cellpadding="3">
			<h:link outcome="homePage" value="Admin Console"/>
			
			 <h:outputText value="new package" />  
			  
			  <h:link outcome="newFlight" value="new flight"/>
			  
			  <h:link outcome="newHotel" value="new hotel"/> 
			  
			  <h:link outcome="newExcursion" value="new excursion"/>
			  
			  <h:link outcome="showAllPackages" value="show all packages" /> 
			 
			  <h:link outcome="showAllHotels" value="show All Hotels"/> 
			   
			  <h:link outcome="showAllFlights" value="show All flights"/>
			   
			  <h:link outcome="showExcursion" value="show excursions"/> 
			  
			  <h:link outcome="manageCity" value="manage city"/>
			  
	 
			  <h:form>
				<p:commandButton id="logoutButton" value="logout" action="#{logout.logout()}"/>
			</h:form>
		</h:panelGrid>
	
	</p:panel>
	<h:form id="packageForm">
	
	<p:panel header="New Travel Package">  
       	<h:panelGrid columns="3" cellpadding="0">  
            		
		<p:outputLabel for="id" value="Id" /> 
		<p:inputMask id="id" value="#{packageCreation.travelPackageDTO.id}" mask="9999"/>
		<p:outputLabel value="#{packageCreation.errorPackageId}" />
		
		<p:outputLabel for="newPackageName" value="Package Name" /> 
		<p:inputText id="newPackageName" value="#{packageCreation.travelPackageDTO.packageName}" /> 
		<h:message for="newPackageName"/>
		
		<p:outputLabel for="description" value="Package Description" />
		<p:inputTextarea rows="8" cols="40" id="description" value="#{packageCreation.travelPackageDTO.description}" />
		<h:message for="description"/>
		
		<h:outputText value="city" />
		<p:selectOneMenu value="#{packageCreation.travelPackageDTO.city}"  panelStyle="width:150px" 
         effect="fade" var="p" style="width:160px"  filter="true" filterMatchMode="startsWith">
         <f:selectItem itemLabel="Select One" itemValue="" /> 
        <f:selectItems value="#{packageCreation.cityDTOs}" var="CityDTO" itemLabel="#{CityDTO.city}" itemValue="#{CityDTO.city}"/>
         </p:selectOneMenu> 
         <h:outputText value="" />
         		
		<p:outputLabel for="key1" value="keyWord1" />
		<p:inputText id="key1" value="#{packageCreation.travelPackageDTO.keyWord1}" />
		<h:message for="key1"/>
		
		<p:outputLabel for="key2" value="keyWord2 (Optional)" />
		<p:inputText id="key2" value="#{packageCreation.travelPackageDTO.keyWord2}" />
		<h:message for="key2"/>
		
		<p:outputLabel for="key3" value="keyWord3 (Optional)" />
		<p:inputText id="key3" value="#{packageCreation.travelPackageDTO.keyWord3}" />
		<h:message for="key3"/>
			
		<p:outputLabel for="packagePerson" value="Number of Person" />
		<p:inputText id="packagePerson" value="#{packageCreation.travelPackageDTO.numberOfPerson}" />
		<h:outputLabel value="#{packageCreation.errorNumberPerson}" />
		
		<h:outputText value="From" /> 
     	<p:calendar value="#{packageCreation.travelPackageDTO.arrivo}" pattern="MM/dd/yyyy HH:mm" />
     	<h:outputLabel value="" />
     	
     	<h:outputText value="Nights" /> 
     	<p:inputText value="#{packageCreation.travelPackageDTO.numberOfNights}" />
   		<h:outputLabel value="" />
     		
 

		<p:commandButton action="#{packageCreation.CreatePackage()}" value="create" update="packageForm"
		rendered="#{!packageCreation.confirmCreation}"/>
		<h:outputLabel value="#{packageCreation.errorFlight}" />
		<h:outputLabel value="" />
		
		<h:outputLabel value="" />
		<h:outputLabel value="#{packageCreation.errorHotel}" />
		<h:outputLabel value="" />
		
		<h:outputLabel value="" />
		<h:outputLabel value="#{packageCreation.errorExcursion}" />
		<h:outputLabel value="" />
		
		<h:outputLabel value="" />
		<h:outputLabel value="#{packageCreation.errorIdAlreadyExist}" />
		<h:outputLabel value="" />
		
		<h:outputLabel value="" />
		<h:outputLabel value="#{packageCreation.errorNameAlreadyExist}" />
		<h:outputLabel value="" />
		
  </h:panelGrid>
    
   </p:panel>  
   <p:panel header="Your Package" rendered="#{packageCreation.confirmCreation}">  
       	
  			<h:outputLabel value="id: #{packageCreation.travelPackageDTO.id}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Name #{packageCreation.travelPackageDTO.packageName}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Description: #{packageCreation.travelPackageDTO.description}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Key1: #{packageCreation.travelPackageDTO.keyWord1}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Key2: #{packageCreation.travelPackageDTO.keyWord2}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Key3: #{packageCreation.travelPackageDTO.keyWord3}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Person: #{packageCreation.travelPackageDTO.numberOfPerson}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			
 			<h:outputLabel value="Flight #{packageCreation.travelPackageDTO.packageFlights}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Hotel #{packageCreation.travelPackageDTO.packageHotelDTOs}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			<h:outputLabel value="Excursion #{packageCreation.travelPackageDTO.packageExcursions}" rendered="#{packageCreation.confirmCreation}"/><br/>
 			
 			<p:commandButton action="#{packageCreation.confirmCreation()}" value="confirm"
			rendered="#{packageCreation.confirmCreation}" update="packageForm"/>
		
			<p:commandButton action="#{packageCreation.cancelCreation()}" value="cancel"
			rendered="#{packageCreation.confirmCreation}" update="packageForm"/>
   </p:panel> 
</h:form>


<div id="AddFlight">

<p:panel header="Add Flights" styleClass="blue-header">


<h:form>
		
		    	<p:dataTable id="resultDataTableFlight" var="FlightDTO" value="#{packageCreation.allflights}">  
		    	 <f:facet name="header">  
          				  	Add flights  
       					 </f:facet> 
			       <p:column headerText="Id">  
			            <h:outputText value="#{FlightDTO.id}" />  
			       </p:column>  
			     
			      <p:column headerText="ArrivalCity">  
			            <h:outputText value="#{FlightDTO.arrivalCity}" />  
			        </p:column>  
			  
			      <p:column headerText="DepartureCity">  
			            <h:outputText value="#{FlightDTO.departureCity}" />  
			        </p:column>  
			        
			 		 <p:column headerText="Data">  
			            <h:outputText value="#{FlightDTO.data}" />  
			        </p:column>
			        
			        <p:column headerText="Price">  
			            <h:outputText value="#{FlightDTO.price}" />  
			        </p:column>
			   
			         <p:column headerText="">  
			        <p:commandButton value="Add" rendered="#{packageCreation.isAdd.get(FlightDTO.id)}" actionListener="#{packageCreation.addFlight(FlightDTO)}"
			        update="resultDataTableFlight"/>		        
			         
			        <p:commandButton value="Remove" rendered="#{!packageCreation.isAdd.get(FlightDTO.id)}" actionListener="#{packageCreation.removeFlight(FlightDTO)}"
			        update="resultDataTableFlight"/>		        
			        </p:column>
			     		  
    	</p:dataTable>  
	

	</h:form>
</p:panel>
  </div>  
    	<div id="allHotels">
    	
		<p:panel header="Add Hotels" styleClass="orange-header">
		
		
			<h:form >  
		    	<p:dataTable id="resultDataTableHotel" var="HotelDTO" value="#{packageCreation.allHotels}">  
		    	 <f:facet name="header">  
          				  	All Hotel  
       					 </f:facet> 
			       <p:column headerText="Id">  
			            <h:outputText value="#{HotelDTO.id}" />  
			       </p:column>  
			     
			      <p:column headerText="Description">  
			            <h:outputText value="#{HotelDTO.description}" />  
			        </p:column>  
			  
			      <p:column headerText="name">  
			            <h:outputText value="#{HotelDTO.name}" />  
			        </p:column>  
			        
			 		 <p:column headerText="Address">  
			            <h:outputText value="#{HotelDTO.address}" />  
			        </p:column>
			        
			         <p:column headerText="stars">  
			            <h:outputText value="#{HotelDTO.stars}" />  
			        </p:column>
			        
			        <p:column headerText="Price">  
			            <h:outputText value="#{HotelDTO.price}" />  
			        </p:column>
			        
			         <p:column headerText="">  
			        <p:commandButton value="Add" rendered="#{packageCreation.isAddhotel.get(HotelDTO.id)}" actionListener="#{packageCreation.addHotel(HotelDTO)}"
			        update="resultDataTableHotel"/>		        

			        <p:commandButton value="Remove" rendered="#{!packageCreation.isAddhotel.get(HotelDTO.id)}" actionListener="#{packageCreation.removeHotel(HotelDTO)}"
			        update="resultDataTableHotel"/>		        
			        </p:column>
     		  
    	</p:dataTable> 
    	 
	</h:form>
	</p:panel>
	<div id="allExcursion">
		<p:panel header="Add Excursions" styleClass="green-header">
		
			<h:form >  
		    	<p:dataTable id="resultDataTableExcursion" var="ExcursionDTO" value="#{packageCreation.allExcursion}">  
		    	 <f:facet name="header">  
          				  	All Excursion  
       					 </f:facet> 
			       <p:column headerText="Id">  
			            <h:outputText value="#{ExcursionDTO.id}" />  
			       </p:column>  

			      <p:column headerText="name">  
			            <h:outputText value="#{ExcursionDTO.name}" />  
			        </p:column>  
			        
			        <p:column headerText="Description">  
			            <h:outputText value="#{ExcursionDTO.description}" />  
			        </p:column> 
			        
			         <p:column headerText="price">  
			            <h:outputText value="#{ExcursionDTO.price}" />  
			        </p:column>  
			        
			         <p:column headerText="">  
			        <p:commandButton value="Add" rendered="#{packageCreation.isAddExcursion.get(ExcursionDTO.id)}" actionListener="#{packageCreation.addExcursion(ExcursionDTO)}"
			        update="resultDataTableExcursion"/>		        
 
			        <p:commandButton value="Remove" rendered="#{!packageCreation.isAddExcursion.get(ExcursionDTO.id)}" actionListener="#{packageCreation.removeExcursion(ExcursionDTO)}"
			        update="resultDataTableExcursion"/>		        
			        </p:column>
			      
     		  
    	</p:dataTable> 
    	 
	</h:form>
	</p:panel>
</div>
		

		
	
</div>
</body> 
</html>
